/**
 * Created by zhangligang
 * Email: tzhang2450@163.com
 * Date: 2018/11/26
 * Time: 11:16
 */
$(function(){
    var authorization = Cookies.get('_token');

    $('.btn-save').on('click', function(){
        var params = {
            username: $('.username').val(),
            password: $('.password').val(),
            role: $('.role').val()
        };
        $.ajax({
            type: 'post',
            url: '/v1/manager/saveUser',
            headers: {
                Authorization: authorization,
                Accept: "application/json; charset=utf-8"
            },
            data: {params: params},
            success: function(e){
                var data = JSON.parse(e);
                if (data.status == 200) {
                    alert('添加成功!');
                    location.href = '/manager/user.html';
                }
            }
        });
    });
});
